Skip to contentSkip to conversation

Change in openvpn[master]: test_options_parse: Start new UT for options_parse.c

Openvpn-devel In review flichtenheld (Code Review) 2 participants 10 messages Sep 30, 2025 – Oct 8, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1759239739000.I95032d2539d994abf69fc17319ed1a429c3bb948@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1244?usp=email

to review the following change.

Change subject: test_options_parse: Start new UT for options_parse.c
......................................................................

test_options_parse: Start new UT for options_parse.c

For now contains one test case for parse_line.

Change-Id I95032d2539d994abf69fc17319ed1a429c3bb948

---
M CMakeLists.txt
M tests/unit_tests/openvpn/Makefile.am
A tests/unit_tests/openvpn/test_options_parse.c

3 files changed, 215 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/44/1244/1

CMakeLists.txt +15 -0
index aeef480..37bfc03 100644
@@ -685,6 +685,7 @@
     # Clang-cl (which is also MSVC) is wrongly detected to support wrap
     if (NOT MSVC AND "${LD_SUPPORTS_WRAP}")
         list(APPEND unit_tests
+            "test_options_parse"
             "test_tls_crypt"
             )
     endif ()
@@ -826,6 +827,20 @@
         src/compat/compat-strsep.c
         )
 
+    if (TARGET test_options_parse)
+        target_link_options(test_options_parse PRIVATE
+            -Wl,--wrap=add_option
+            -Wl,--wrap=remove_option
+            -Wl,--wrap=update_option
+	    -Wl,--wrap=usage
+        )
+        target_sources(test_options_parse PRIVATE
+            tests/unit_tests/openvpn/mock_get_random.c
+            src/openvpn/options_parse.c
+            src/openvpn/options_util.c
+        )
+    endif ()
+
     target_sources(test_packet_id PRIVATE
         tests/unit_tests/openvpn/mock_get_random.c
         src/openvpn/otime.c
tests/unit_tests/openvpn/Makefile.am +15 -0
index e4749d2..8e94665 100644
@@ -191,6 +191,21 @@
 	$(top_srcdir)/src/openvpn/platform.c
 endif
 
+options_parse_testdriver_CFLAGS  = -I$(top_srcdir)/src/openvpn -I$(top_srcdir)/src/compat @TEST_CFLAGS@
+options_parse_testdriver_LDFLAGS = @TEST_LDFLAGS@ -L$(top_srcdir)/src/openvpn \
+	-Wl,--wrap=add_option \
+	-Wl,--wrap=update_option \
+	-Wl,--wrap=remove_option \
+	-Wl,--wrap=usage
+options_parse_testdriver_SOURCES = test_options_parse.c \
+	mock_msg.c mock_msg.h test_common.h \
+	mock_get_random.c \
+	$(top_srcdir)/src/openvpn/options_parse.c \
+	$(top_srcdir)/src/openvpn/options_util.c \
+	$(top_srcdir)/src/openvpn/buffer.c \
+	$(top_srcdir)/src/openvpn/win32-util.c \
+	$(top_srcdir)/src/openvpn/platform.c
+
 provider_testdriver_CFLAGS  = \
 	-I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn \
 	@TEST_CFLAGS@ $(OPTIONAL_CRYPTO_CFLAGS)
tests/unit_tests/openvpn/test_options_parse.c new file +185 -0

185 lines not on this page · raw message

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1244?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I95032d2539d994abf69fc17319ed1a429c3bb948
Gerrit-Change-Number: 1244
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1244?usp=email

to look at the new patch set (#2).

Change subject: test_options_parse: Start new UT for options_parse.c
......................................................................

test_options_parse: Start new UT for options_parse.c

For now contains one test case for parse_line.

Change-Id I95032d2539d994abf69fc17319ed1a429c3bb948

---
M CMakeLists.txt
M tests/unit_tests/openvpn/Makefile.am
A tests/unit_tests/openvpn/test_options_parse.c

3 files changed, 216 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/44/1244/2

CMakeLists.txt +15 -0
index aeef480..37bfc03 100644
@@ -685,6 +685,7 @@
     # Clang-cl (which is also MSVC) is wrongly detected to support wrap
     if (NOT MSVC AND "${LD_SUPPORTS_WRAP}")
         list(APPEND unit_tests
+            "test_options_parse"
             "test_tls_crypt"
             )
     endif ()
@@ -826,6 +827,20 @@
         src/compat/compat-strsep.c
         )
 
+    if (TARGET test_options_parse)
+        target_link_options(test_options_parse PRIVATE
+            -Wl,--wrap=add_option
+            -Wl,--wrap=remove_option
+            -Wl,--wrap=update_option
+	    -Wl,--wrap=usage
+        )
+        target_sources(test_options_parse PRIVATE
+            tests/unit_tests/openvpn/mock_get_random.c
+            src/openvpn/options_parse.c
+            src/openvpn/options_util.c
+        )
+    endif ()
+
     target_sources(test_packet_id PRIVATE
         tests/unit_tests/openvpn/mock_get_random.c
         src/openvpn/otime.c
tests/unit_tests/openvpn/Makefile.am +16 -0
index f7b1bc8..8e94665 100644
@@ -9,6 +9,7 @@
 	user_pass_testdriver push_update_msg_testdriver provider_testdriver socket_testdriver
 
 if HAVE_LD_WRAP_SUPPORT
+test_binaries += options_parse_testdriver
 if !WIN32
 test_binaries += tls_crypt_testdriver
 endif
@@ -190,6 +191,21 @@
 	$(top_srcdir)/src/openvpn/platform.c
 endif
 
+options_parse_testdriver_CFLAGS  = -I$(top_srcdir)/src/openvpn -I$(top_srcdir)/src/compat @TEST_CFLAGS@
+options_parse_testdriver_LDFLAGS = @TEST_LDFLAGS@ -L$(top_srcdir)/src/openvpn \
+	-Wl,--wrap=add_option \
+	-Wl,--wrap=update_option \
+	-Wl,--wrap=remove_option \
+	-Wl,--wrap=usage
+options_parse_testdriver_SOURCES = test_options_parse.c \
+	mock_msg.c mock_msg.h test_common.h \
+	mock_get_random.c \
+	$(top_srcdir)/src/openvpn/options_parse.c \
+	$(top_srcdir)/src/openvpn/options_util.c \
+	$(top_srcdir)/src/openvpn/buffer.c \
+	$(top_srcdir)/src/openvpn/win32-util.c \
+	$(top_srcdir)/src/openvpn/platform.c
+
 provider_testdriver_CFLAGS  = \
 	-I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn \
 	@TEST_CFLAGS@ $(OPTIONAL_CRYPTO_CFLAGS)
tests/unit_tests/openvpn/test_options_parse.c new file +185 -0

185 lines not on this page · raw message

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1244?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I95032d2539d994abf69fc17319ed1a429c3bb948
Gerrit-Change-Number: 1244
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1244?usp=email

to look at the new patch set (#3).

Change subject: test_options_parse: Start new UT for options_parse.c
......................................................................

test_options_parse: Start new UT for options_parse.c

For now contains one test case for parse_line.

Change-Id I95032d2539d994abf69fc17319ed1a429c3bb948

---
M CMakeLists.txt
M tests/unit_tests/openvpn/Makefile.am
A tests/unit_tests/openvpn/test_options_parse.c

3 files changed, 227 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/44/1244/3

CMakeLists.txt +15 -0
index aeef480..37bfc03 100644
@@ -685,6 +685,7 @@
     # Clang-cl (which is also MSVC) is wrongly detected to support wrap
     if (NOT MSVC AND "${LD_SUPPORTS_WRAP}")
         list(APPEND unit_tests
+            "test_options_parse"
             "test_tls_crypt"
             )
     endif ()
@@ -826,6 +827,20 @@
         src/compat/compat-strsep.c
         )
 
+    if (TARGET test_options_parse)
+        target_link_options(test_options_parse PRIVATE
+            -Wl,--wrap=add_option
+            -Wl,--wrap=remove_option
+            -Wl,--wrap=update_option
+	    -Wl,--wrap=usage
+        )
+        target_sources(test_options_parse PRIVATE
+            tests/unit_tests/openvpn/mock_get_random.c
+            src/openvpn/options_parse.c
+            src/openvpn/options_util.c
+        )
+    endif ()
+
     target_sources(test_packet_id PRIVATE
         tests/unit_tests/openvpn/mock_get_random.c
         src/openvpn/otime.c
tests/unit_tests/openvpn/Makefile.am +16 -0
index f7b1bc8..8e94665 100644
@@ -9,6 +9,7 @@
 	user_pass_testdriver push_update_msg_testdriver provider_testdriver socket_testdriver
 
 if HAVE_LD_WRAP_SUPPORT
+test_binaries += options_parse_testdriver
 if !WIN32
 test_binaries += tls_crypt_testdriver
 endif
@@ -190,6 +191,21 @@
 	$(top_srcdir)/src/openvpn/platform.c
 endif
 
+options_parse_testdriver_CFLAGS  = -I$(top_srcdir)/src/openvpn -I$(top_srcdir)/src/compat @TEST_CFLAGS@
+options_parse_testdriver_LDFLAGS = @TEST_LDFLAGS@ -L$(top_srcdir)/src/openvpn \
+	-Wl,--wrap=add_option \
+	-Wl,--wrap=update_option \
+	-Wl,--wrap=remove_option \
+	-Wl,--wrap=usage
+options_parse_testdriver_SOURCES = test_options_parse.c \
+	mock_msg.c mock_msg.h test_common.h \
+	mock_get_random.c \
+	$(top_srcdir)/src/openvpn/options_parse.c \
+	$(top_srcdir)/src/openvpn/options_util.c \
+	$(top_srcdir)/src/openvpn/buffer.c \
+	$(top_srcdir)/src/openvpn/win32-util.c \
+	$(top_srcdir)/src/openvpn/platform.c
+
 provider_testdriver_CFLAGS  = \
 	-I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn \
 	@TEST_CFLAGS@ $(OPTIONAL_CRYPTO_CFLAGS)
tests/unit_tests/openvpn/test_options_parse.c new file +196 -0

196 lines not on this page · raw message

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1244?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I95032d2539d994abf69fc17319ed1a429c3bb948
Gerrit-Change-Number: 1244
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

#4 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1244?usp=email )

Change subject: test_options_parse: Start new UT for options_parse.c
......................................................................

Patch Set 3: Code-Review-1

(2 comments)

Patchset:

PS3:
confused about _wrap_*

File tests/unit_tests/openvpn/test_options_parse.c:

http://gerrit.openvpn.net/c/openvpn/+/1244/comment/96e18f0a_7dec87ea?usp=email :
PS3, Line 41: __wrap_add_option(struct options *options, char *p[], bool is_inline, const char *file, why _wrap_...? Shouldn't this just work with normal linking, given that we do not link options.o?

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1244?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I95032d2539d994abf69fc17319ed1a429c3bb948
Gerrit-Change-Number: 1244
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 07 Oct 2025 20:05:57 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes

#5 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1244?usp=email )

Change subject: test_options_parse: Start new UT for options_parse.c
......................................................................

Patch Set 3: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1244?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I95032d2539d994abf69fc17319ed1a429c3bb948
Gerrit-Change-Number: 1244
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 08 Oct 2025 10:02:28 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#6 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1244?usp=email )

Change subject: test_options_parse: Start new UT for options_parse.c
......................................................................

Patch Set 3:

(1 comment)

Patchset:

PS3:
Still confused about the necessity of __wrap_* here, but decided to move on and let this not block me for now. If it turns out to be needed, fine, and if not, a followup patch can remove it.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1244?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I95032d2539d994abf69fc17319ed1a429c3bb948
Gerrit-Change-Number: 1244
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 08 Oct 2025 10:03:31 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

#7 lore raw

PATCH v3 1/1 test_options_parse: Start new UT for options_parse.c

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

For now contains one test case for parse_line.

Change-Id I95032d2539d994abf69fc17319ed1a429c3bb948

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1244
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1244
This mail reflects revision 3 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

CMakeLists.txt +15 -0
index aeef480..37bfc03 100644
@@ -685,6 +685,7 @@
     # Clang-cl (which is also MSVC) is wrongly detected to support wrap
     if (NOT MSVC AND "${LD_SUPPORTS_WRAP}")
         list(APPEND unit_tests
+            "test_options_parse"
             "test_tls_crypt"
             )
     endif ()
@@ -826,6 +827,20 @@
         src/compat/compat-strsep.c
         )
 
+    if (TARGET test_options_parse)
+        target_link_options(test_options_parse PRIVATE
+            -Wl,--wrap=add_option
+            -Wl,--wrap=remove_option
+            -Wl,--wrap=update_option
+	    -Wl,--wrap=usage
+        )
+        target_sources(test_options_parse PRIVATE
+            tests/unit_tests/openvpn/mock_get_random.c
+            src/openvpn/options_parse.c
+            src/openvpn/options_util.c
+        )
+    endif ()
+
     target_sources(test_packet_id PRIVATE
         tests/unit_tests/openvpn/mock_get_random.c
         src/openvpn/otime.c
tests/unit_tests/openvpn/Makefile.am +16 -0
index f7b1bc8..8e94665 100644
@@ -9,6 +9,7 @@
 	user_pass_testdriver push_update_msg_testdriver provider_testdriver socket_testdriver
 
 if HAVE_LD_WRAP_SUPPORT
+test_binaries += options_parse_testdriver
 if !WIN32
 test_binaries += tls_crypt_testdriver
 endif
@@ -190,6 +191,21 @@
 	$(top_srcdir)/src/openvpn/platform.c
 endif
 
+options_parse_testdriver_CFLAGS  = -I$(top_srcdir)/src/openvpn -I$(top_srcdir)/src/compat @TEST_CFLAGS@
+options_parse_testdriver_LDFLAGS = @TEST_LDFLAGS@ -L$(top_srcdir)/src/openvpn \
+	-Wl,--wrap=add_option \
+	-Wl,--wrap=update_option \
+	-Wl,--wrap=remove_option \
+	-Wl,--wrap=usage
+options_parse_testdriver_SOURCES = test_options_parse.c \
+	mock_msg.c mock_msg.h test_common.h \
+	mock_get_random.c \
+	$(top_srcdir)/src/openvpn/options_parse.c \
+	$(top_srcdir)/src/openvpn/options_util.c \
+	$(top_srcdir)/src/openvpn/buffer.c \
+	$(top_srcdir)/src/openvpn/win32-util.c \
+	$(top_srcdir)/src/openvpn/platform.c
+
 provider_testdriver_CFLAGS  = \
 	-I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn \
 	@TEST_CFLAGS@ $(OPTIONAL_CRYPTO_CFLAGS)
tests/unit_tests/openvpn/test_options_parse.c new file +196 -0

196 lines not on this page · raw message

#8 lore raw

[Openvpn-devel] [PATCH applied] Re: test_options_parse: Start new UT for options_parse.c

"Because it makes sense" - tested on Linux/Cmocka, works.

GHA might need adjustments to test this on mingw->windows (opened an issue for that). I'm still not sure we need the __wrap_* dance here, but that can be clarified (+changed if needed) later.

Your patch has been applied to the master branch.

commit 80981cf33880d9bf995da0dbd09becedce421d5e

Author: Frank Lichtenheld
Date:   Wed Oct 8 12:10:09 2025 +0200
     test_options_parse: Start new UT for options_parse.c

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1244
     Message-Id: <[email protected]...>
     URL: https://sourceforge.net/p/openvpn/mailman/message/59243816/
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#9 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#4) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1244?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: test_options_parse: Start new UT for options_parse.c
......................................................................

test_options_parse: Start new UT for options_parse.c

For now contains one test case for parse_line.

Change-Id I95032d2539d994abf69fc17319ed1a429c3bb948

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1244
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59243816/

---
M CMakeLists.txt
M tests/unit_tests/openvpn/Makefile.am
A tests/unit_tests/openvpn/test_options_parse.c

3 files changed, 227 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/44/1244/4

CMakeLists.txt +15 -0
index aeef480..37bfc03 100644
@@ -685,6 +685,7 @@
     # Clang-cl (which is also MSVC) is wrongly detected to support wrap
     if (NOT MSVC AND "${LD_SUPPORTS_WRAP}")
         list(APPEND unit_tests
+            "test_options_parse"
             "test_tls_crypt"
             )
     endif ()
@@ -826,6 +827,20 @@
         src/compat/compat-strsep.c
         )
 
+    if (TARGET test_options_parse)
+        target_link_options(test_options_parse PRIVATE
+            -Wl,--wrap=add_option
+            -Wl,--wrap=remove_option
+            -Wl,--wrap=update_option
+	    -Wl,--wrap=usage
+        )
+        target_sources(test_options_parse PRIVATE
+            tests/unit_tests/openvpn/mock_get_random.c
+            src/openvpn/options_parse.c
+            src/openvpn/options_util.c
+        )
+    endif ()
+
     target_sources(test_packet_id PRIVATE
         tests/unit_tests/openvpn/mock_get_random.c
         src/openvpn/otime.c
tests/unit_tests/openvpn/Makefile.am +16 -0
index f7b1bc8..8e94665 100644
@@ -9,6 +9,7 @@
 	user_pass_testdriver push_update_msg_testdriver provider_testdriver socket_testdriver
 
 if HAVE_LD_WRAP_SUPPORT
+test_binaries += options_parse_testdriver
 if !WIN32
 test_binaries += tls_crypt_testdriver
 endif
@@ -190,6 +191,21 @@
 	$(top_srcdir)/src/openvpn/platform.c
 endif
 
+options_parse_testdriver_CFLAGS  = -I$(top_srcdir)/src/openvpn -I$(top_srcdir)/src/compat @TEST_CFLAGS@
+options_parse_testdriver_LDFLAGS = @TEST_LDFLAGS@ -L$(top_srcdir)/src/openvpn \
+	-Wl,--wrap=add_option \
+	-Wl,--wrap=update_option \
+	-Wl,--wrap=remove_option \
+	-Wl,--wrap=usage
+options_parse_testdriver_SOURCES = test_options_parse.c \
+	mock_msg.c mock_msg.h test_common.h \
+	mock_get_random.c \
+	$(top_srcdir)/src/openvpn/options_parse.c \
+	$(top_srcdir)/src/openvpn/options_util.c \
+	$(top_srcdir)/src/openvpn/buffer.c \
+	$(top_srcdir)/src/openvpn/win32-util.c \
+	$(top_srcdir)/src/openvpn/platform.c
+
 provider_testdriver_CFLAGS  = \
 	-I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn \
 	@TEST_CFLAGS@ $(OPTIONAL_CRYPTO_CFLAGS)
tests/unit_tests/openvpn/test_options_parse.c new file +196 -0

196 lines not on this page · raw message

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1244?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I95032d2539d994abf69fc17319ed1a429c3bb948
Gerrit-Change-Number: 1244
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#10 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1244?usp=email )

Change subject: test_options_parse: Start new UT for options_parse.c
......................................................................

test_options_parse: Start new UT for options_parse.c

For now contains one test case for parse_line.

Change-Id I95032d2539d994abf69fc17319ed1a429c3bb948

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1244
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59243816/

---
M CMakeLists.txt
M tests/unit_tests/openvpn/Makefile.am
A tests/unit_tests/openvpn/test_options_parse.c

3 files changed, 227 insertions(+), 0 deletions(-)
CMakeLists.txt +15 -0
index aeef480..37bfc03 100644
@@ -685,6 +685,7 @@
     # Clang-cl (which is also MSVC) is wrongly detected to support wrap
     if (NOT MSVC AND "${LD_SUPPORTS_WRAP}")
         list(APPEND unit_tests
+            "test_options_parse"
             "test_tls_crypt"
             )
     endif ()
@@ -826,6 +827,20 @@
         src/compat/compat-strsep.c
         )
 
+    if (TARGET test_options_parse)
+        target_link_options(test_options_parse PRIVATE
+            -Wl,--wrap=add_option
+            -Wl,--wrap=remove_option
+            -Wl,--wrap=update_option
+	    -Wl,--wrap=usage
+        )
+        target_sources(test_options_parse PRIVATE
+            tests/unit_tests/openvpn/mock_get_random.c
+            src/openvpn/options_parse.c
+            src/openvpn/options_util.c
+        )
+    endif ()
+
     target_sources(test_packet_id PRIVATE
         tests/unit_tests/openvpn/mock_get_random.c
         src/openvpn/otime.c
tests/unit_tests/openvpn/Makefile.am +16 -0
index f7b1bc8..8e94665 100644
@@ -9,6 +9,7 @@
 	user_pass_testdriver push_update_msg_testdriver provider_testdriver socket_testdriver
 
 if HAVE_LD_WRAP_SUPPORT
+test_binaries += options_parse_testdriver
 if !WIN32
 test_binaries += tls_crypt_testdriver
 endif
@@ -190,6 +191,21 @@
 	$(top_srcdir)/src/openvpn/platform.c
 endif
 
+options_parse_testdriver_CFLAGS  = -I$(top_srcdir)/src/openvpn -I$(top_srcdir)/src/compat @TEST_CFLAGS@
+options_parse_testdriver_LDFLAGS = @TEST_LDFLAGS@ -L$(top_srcdir)/src/openvpn \
+	-Wl,--wrap=add_option \
+	-Wl,--wrap=update_option \
+	-Wl,--wrap=remove_option \
+	-Wl,--wrap=usage
+options_parse_testdriver_SOURCES = test_options_parse.c \
+	mock_msg.c mock_msg.h test_common.h \
+	mock_get_random.c \
+	$(top_srcdir)/src/openvpn/options_parse.c \
+	$(top_srcdir)/src/openvpn/options_util.c \
+	$(top_srcdir)/src/openvpn/buffer.c \
+	$(top_srcdir)/src/openvpn/win32-util.c \
+	$(top_srcdir)/src/openvpn/platform.c
+
 provider_testdriver_CFLAGS  = \
 	-I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn \
 	@TEST_CFLAGS@ $(OPTIONAL_CRYPTO_CFLAGS)
tests/unit_tests/openvpn/test_options_parse.c new file +196 -0

196 lines not on this page · raw message

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1244?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I95032d2539d994abf69fc17319ed1a429c3bb948
Gerrit-Change-Number: 1244
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>